/*
	Copyright (c) 2011 Canadensys
*/
package net.canadensys.dataportal.vascan.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import freemarker.log.Logger;

import net.canadensys.dataportal.vascan.config.ConfigManager;
import net.canadensys.dataportal.vascan.config.impl.InstallationConfig;
import net.canadensys.dataportal.vascan.config.impl.InstallationConfigValidator;
import net.canadensys.dataportal.vascan.utils.SiteMap;

/**
 * This class contains calls to initialization methods.
 * This class will be called at each deploy of the WebApp
 */
public class ServletInitializer  extends HttpServlet {
	
	private static final long serialVersionUID = 800750579657221432L;

	public void init() throws ServletException {
		Logger.getLogger(ServletInitializer.class.getName()).info("Vascan-Portal Initialization...");
		Logger.getLogger(ServletInitializer.class.getName()).info("Vascan-Portal running from " + getServletContext().getRealPath(""));
		
		ConfigManager.loadConfiguration(getServletContext().getRealPath(""), InstallationConfig.getInstance(), new InstallationConfigValidator());
		
		//Copy site map XML files(if needed)
		SiteMap.copySiteMap();
    }
}
